import Vue from 'vue'
import VueRouter from 'vue-router'

// 一级路由
import Layout from '@/views/Layout.vue'
import Detail from '@/views/Detail.vue'

// 二级路由
import Article from '@/views/Article.vue'
import Collect from '@/views/Collect.vue'
import Like from '@/views/Like.vue'
import User from '@/views/User.vue'


Vue.use(VueRouter) // VueRouter插件初始化

// 创建了一个路由对象
const router = new VueRouter({
  routes: [
     {
      path: '/', 
      component: Layout,
      children: [ // 二级路由
         {path: '', component: Article}, // /
         {path: 'like', component: Like}, // /like
         {path: 'user', component: User}, // /user
         {path: 'collect', component: Collect} // /collect
      ]
    },
     {path: '/detail', component: Detail}
  ]
})

export default router